<script>
import MainPageTeacher from "@/views/main/teacher/index.vue"
import MainPageStudent from "@/views/main/student/index.vue"
import {getRequest} from "@/utils/api";

export default {
  components: {
    MainPageTeacher,
    MainPageStudent
  },
  name: "MainPage",
  data() {
    return {
      type:1,

    }
  },
  methods:{
    getUserInfo() {
    const userMessage =JSON.parse(localStorage.getItem('UserInfo'))
      getRequest('/userCourse/getUserInfo',{id:userMessage.id}).then(res => {
        console.log(res)
        localStorage.setItem('UserInfo',JSON.stringify(res.data.data))
        this.type = res.data.data.type
      })
    },
  },
  mounted() {
  this.getUserInfo();
  },

}
</script>

<template>
  <div>
    <MainPageStudent v-if="this.type===1">
    </MainPageStudent>
    <MainPageTeacher v-if="this.type===2">
    </MainPageTeacher>
  </div>


</template>

<style scoped>

</style>